/* 
 *	DSPBasic.h
 *	Author: Leo 30 apr 2010
 *	Basic DSP building blocks, such as FIR filters, FFT, and so on.
 *	Some of these are going to be left for more efficient DSPlib functions
 */


/* ========================================================================== */
/*                                  FIR/IIR                                   */
/* ========================================================================== */


/*void DSPF_sp_fir_gen(const float *x, 		//signal, must be long nh+nr-1, x starts at x(-nh+1) and ends at x(nr-1)
					 const float *h,		//FIR coeffs, need to be laced in the h array in reverse order {h(nh-1), ... , h(1), h(0)}
					 float * restrict r,	//output signal
					 int nh,				//h length
					 int nr);				//r length
*/
/* C implementation of filt filt: zero-phase filter, see Matlab help */
void C_filtfilt(	float *x,
					const float *h,
					float * restrict r,
					int nh,
					int nr);

void my_FIR(float* x, const float* h, float* y, int nh, int ny);

#define max(a,b) ((a) < (b) ? (b) : (a))
#define min(a,b) ((a) > (b) ? (b) : (a))

/* ========================================================================== */
/*                              WINDOWS (non XP!!)                            */
/* ========================================================================== */

float* recwin(int n);

/* ========================================================================== */
/*                           MULTIRATE BLOCKS                                 */
/* ========================================================================== */

/* downsample (doesn't implement LP filter) */
void dwnsmpl ( float* y, long ny, int factor );
/* idem */
void upsample ( float* x, float* y, long nx, int factor ); 


/* ========================================================================== */
/*                           VECTOR MANIPULATION                              */
/* ========================================================================== */

/* simple function to erase a vector, i.e. make it zeros */
void erasevec(float* vec, int len);

/* simple function to pad a vector or a portion of length len with val values */
void fillvec(float* vec, float val, int len);


/* ========================================================================== */
/*                           MEDIAN FILTER TORBEN                             */
/* ========================================================================== */

void  median(float*, int);

